package com.eduction.bean;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;


/**
 * session中使用的用户对象
 * <p/>
 * Copyright: Copyright (c) 13-5-21 下午2:06
 * <p/>
 * Company: 
 * <p/>
 * Author: 
 * <p/>
 * Version: 1.0
 * <p/>
 */
public class SessionUser implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String SESSION_USER_KEY = "session_user_key__";
	
	public static final String SESSION_STATUS = "status";

	public static final String SCHOOL_TYPE = "school_type";
	
	public static final String SESSION_USER_TYPE = "user_type";//0 机构  1：材料评审员 2：现场考察员  3：超级管理员 4 ：系统管理员
	/** 图片验证码 session key */
	public static final String SESSION_IMAGE_CODE_KEY = "rand";

	public static final String IDENTITY = "identity";//1:组员  2：组长 3：联络员

	
	/**
	 * 获得当前登录用户信息
	 * 
	 * @return
	 */
	public static SessionUser getSessionUser() {
		HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
		HttpSession session = request.getSession();
		return (SessionUser) session.getAttribute(SESSION_USER_KEY);
	}
	
}
